<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" import="java.util.*,com.hanma.bean.*" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>文档列表 - 光年(Light Year Admin)后台管理系统模板</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link href="/message/manage/css/bootstrap.min.css" rel="stylesheet">
    <link href="/message/manage/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/message/manage/css/style.min.css" rel="stylesheet">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <%@include file="/manage/left.jsp" %>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">
            <nav class="navbar navbar-default">
                <div class="topbar">
                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 新闻列表页面 </span>
                    </div>
                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <span>笔下光年 <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li> <a href="/message/manageIndex.do"><i class="mdi mdi-account"></i> 个人信息</a> </li>
                                <li> <a href="/message/manageLogin.do"><i class="mdi mdi-logout-variant"></i> 退出登录</a> </li>
                            </ul>
                        </li>
                        <%@include file="/manage/header.jsp" %>
                    </ul>
                </div>
            </nav>
        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-toolbar clearfix">
                                <div class="toolbar-btn-action">
                                    <a class="btn btn-primary m-r-5" href="newsadd.do"><i class="mdi mdi-plus"></i>添加新闻</a>
                                </div>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <td>新闻标题</td>
                                            <td>一级名称</td>
                                            <td>二级名称</td>
                                            <td>操作</td>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <%
                                            List<Newsname> newsList = (List<Newsname>)request.getAttribute("newsList1");
                                            if(newsList != null && newsList.size() > 0){
                                                for(Newsname news : newsList){

                                        %>
                                        <tr>
                                            <td><%= news.getTitle() %></td>
                                            <td><%= news.getCate_name() %></td>
                                            <td><%= news.getSe_cate_name() %></td>
                                            <td>
                                                <a  href="newsupdate.do?id=<%= news.getId()%>">修改</a>
                                                <a  href="newsdelete.do?id=<%= news.getId()%>">删除</a>
                                            </td>
                                        </tr>
                                        <%
                                                }
                                            }
                                        %>
                                        </tbody>
                                    </table>
                                </div>
                                <%
                                    String currentPage = request.getAttribute("currentPage").toString();
                                    String totalPage = request.getAttribute("totalPage").toString();
                                    String prePage = request.getAttribute("prePage").toString();
                                    String nextPage = request.getAttribute("nextPage").toString();
                                %>
                                <ul class="pagination">
                                    <li class="disabled"><span>«</span></li>
                                    <li class="active">
                                        <span>当前[<%= currentPage%>]页</span>
                                    </li>
                                    <li>
                                        <span>共[<%= totalPage%>]页</span>
                                    </li>
                                    <%
                                        Integer seCateId = (Integer)request.getAttribute("seCateId");
                                        if(seCateId != 0){
                                    %>
                                        <li>
                                            <span><a href="newslist.do?currentPage=1&seCateId=<%= seCateId%>">首页</a></span>
                                        </li>
                                        <li>
                                            <span><a href="newslist.do?currentPage=<%= prePage%>&seCateId=<%= seCateId%>">上一页</a></span>
                                            <span><a href="newslist.do?currentPage=<%= nextPage%>&seCateId=<%= seCateId%>">下一页</a></span>
                                            <span><a href="newslist.do?currentPage=<%= totalPage%>&seCateId=<%= seCateId%>">尾页</a></span>
                                        </li>
                                    <%
                                        }else{
                                    %>
                                        <li>
                                            <span><a href="newslist.do?currentPage=1">首页</a></span>
                                        </li>
                                        <li>
                                            <span><a href="newslist.do?currentPage=<%= prePage%>">上一页</a></span>
                                            <span><a href="newslist.do?currentPage=<%= nextPage%>">下一页</a></span>
                                            <span><a href="newslist.do?currentPage=<%= totalPage%>">尾页</a></span>
                                        </li>
                                    <%
                                        }
                                    %>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" src="/message/manage/js/jquery.min.js"></script>
<script type="text/javascript" src="/message/manage/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/message/manage/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/message/manage/js/main.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('.search-bar .dropdown-menu a').click(function() {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
</script>
</body>
</html>